package noema.dataModel;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity
public class Patient {
	@Id
	private String healthCardId;
	private String name;
	private String surname;
	private int sessionId;
	@OneToMany(cascade=CascadeType.ALL)
	private List<LongEntity> processIds;
	
	public Patient(String healthCardId, String name, String surname) {
		this();
		this.healthCardId = healthCardId;
		this.name = name;
		this.surname = surname;
	}

	public Patient() {
		super();
	}

	public String getHealthCardId() {
		return healthCardId;
	}

	public void setHealthCardId(String healthCardId) {
		this.healthCardId = healthCardId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public int getSessionId() {
		return sessionId;
	}

	public void setSessionId(int sessionId) {
		this.sessionId = sessionId;
	}

	public List<LongEntity> getProcessIds() {
		return processIds;
	}

	public void setProcessIds(List<LongEntity> processIds) {
		this.processIds = processIds;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((healthCardId == null) ? 0 : healthCardId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Patient other = (Patient) obj;
		if (healthCardId == null) {
			if (other.healthCardId != null)
				return false;
		} else if (!healthCardId.equals(other.healthCardId))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Patient [healthCardId=" + healthCardId + ", name=" + name
				+ ", surname=" + surname + ", sessionId=" + sessionId + "]";
	}	
}
